//定义数组
let arr:number[] = [1,2,3,4]
let arr1:Array<number> = [1,3,4,5]

let arr2:string[] = ['hello','javascript','html']

//元组类型
let foo:[string,number]  = ['hello',100]

//对象类型
// 简单对象Object {name:'jack',age:18}
// 从面向对象角度说 interface定义接口，接口中定义抽象方法
// 从创建对象类型角度说 interface创建对象数据类型
interface IPerson{
    name:string,
    age:number
}

let obj:IPerson = {name:'jack',age:18}
console.log(obj.name)

// type 类型别名
// 给某个类型取一个别名
// 比如string类型，用户名是string类型, 创建一个新的用户名字符串类型，用于定义用户名类型

type UserNameString = string

// let userName:string = 'jack'
let userName:UserNameString = 'jack'

type Person = {
    name:string,
    age:number
}
let obj1:Person = {name:'rose',age:18}

let a:string|number|boolean = 'hello'
a = 100
a = true

type snb = string|number|boolean
let a:snb = 'hello'